package cn.mugutu.test;

import cn.mugutu.finance.domain.system.User;

import java.util.Iterator;
import java.util.SortedSet;
import java.util.TreeSet;

/**
 * Created by gan on 2018/3/22 16:48.
 */
public class B implements  Comparable {

    private String name;
    private Integer age;

    public B(String name, Integer age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        B b = (B) o;

        if (name != null ? !name.equals(b.name) : b.name != null) return false;
        return age != null ? age.equals(b.age) : b.age == null;
    }

    @Override
    public int hashCode() {
        int result = name != null ? name.hashCode() : 0;
        result = 31 * result + (age != null ? age.hashCode() : 0);
        return result;
    }

    public static void main(String[] args) {

        SortedSet sort = new TreeSet<>();

        B u1 = new B("name",1221);

        sort.add(u1);


    }

    @Override
    public int compareTo(Object o) {
        return 0;
    }
}
